package com.whj.servicemap.service.impl;

import com.alibaba.nacos.api.utils.StringUtils;
import com.whj.internalcommon.constant.CommonStatusEnum;
import com.whj.internalcommon.dto.ResponseResult;
import com.whj.servicemap.remote.ServiceClient;
import com.whj.servicemap.service.ServiceMapService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Auther: wanghaijun
 * @Date: 2023/1/16 - 01 - 16 - 14:12 
 * @Description: com.whj.servicemap.service.impl
 */

@Service
public class ServiceMapServiceImpl implements ServiceMapService {


    @Autowired
    private ServiceClient serviceClient;

    /**
     * 创建服务
     *
     * @param name
     * @return
     */
    public ResponseResult add(String name) {

        if (StringUtils.isBlank(name) ){
            return ResponseResult.fail(CommonStatusEnum.SERVICE_NAME_EMPTY.getCode(),CommonStatusEnum.SERVICE_NAME_EMPTY.getValue(),"");
        }
        ResponseResult result = serviceClient.add(name);
        return result;
    }
}
